; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=nary-reassociate -S | FileCheck %s

target datalayout = "e-p:64:64-p1:32:32:32-p2:128:128:128:32-i64:64-v16:16-v32:32-n32:64"

; Even though addrspace(2) has 128 bit pointers, no sign extension needed
; becasue it has 32-bit offsets.
define void @no_sext_fat_pointer(ptr addrspace(2) %a, i32 %i, i32 %j) {
; CHECK-LABEL: @no_sext_fat_pointer(
; CHECK-NEXT:    [[V2:%.*]] = getelementptr float, ptr addrspace(2) [[A:%.*]], i32 [[I:%.*]]
; CHECK-NEXT:    call void @foo(ptr addrspace(2) [[V2]])
; CHECK-NEXT:    [[V3:%.*]] = getelementptr float, ptr addrspace(2) [[V2]], i32 [[J:%.*]]
; CHECK-NEXT:    call void @foo(ptr addrspace(2) [[V3]])
; CHECK-NEXT:    ret void
;
  %v1 = add i32 %i, %j
  %v2 = getelementptr float, ptr addrspace(2) %a, i32 %i
  call void @foo(ptr addrspace(2) %v2)
  %v3 = getelementptr float, ptr addrspace(2) %a, i32 %v1
  call void @foo(ptr addrspace(2) %v3)
  ret void
}

declare void @foo(ptr addrspace(2))
